﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="lp_AdminUrl.aspx.cs" Inherits="ZLDC.Estate.Quantify.workurl.lp_AdminUrl" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="../../js/jquery/jquery-1.3.2.js" type="text/javascript"></script>

    <link href="../../css/main1.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        body
        {
            text-align: center;
        }
        .divadminUrl
        {
            margin-top: 25px;
        }
    </style>

    <script type="text/javascript">
        window.onload = function ajaxList() {

            var userid = '<%=userid %>';
            $.ajax({
                type: "POST",
                url: "../AjaxServer.aspx",
                dataType: 'json',
                data: "alt=AdminUrl&userid=" + userid,
                processData: false,
                timeout: '10000',
                success: function(msg) {

                    divlist(msg);

                },
                error: function() {
                    document.getElementById('divadminUrl').innerHTML = "系统繁忙";
                }

            });

        }

        function divlist(msg) {
            var arr = [];
            arr.push("<table id='tb1' width='500px' border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce' class=\"table\" valign='top'>");
            arr.push("<tr bgcolor=\"#353c44\" >");
            arr.push("<td width=\"100px\"  style='text-align: center;background-color: #d3eaef'  >");
            arr.push("<div >网店名称</div>");
            arr.push("</td>");
            arr.push("<td width=\"75px\"  style='text-align: center;background-color: #d3eaef'>");
            arr.push("<div >网址</div>");
            arr.push("</td>");
            arr.push("<td width=\"75px\"  style='text-align: center;background-color: #d3eaef'>");
            arr.push("<div >备注</div>");
            arr.push("</td>");
            arr.push("<td width=\"75px\"  style='text-align: center;background-color: #d3eaef'>");
            arr.push("<div >操作</div>");
            arr.push("</td>");
            arr.push("</tr>");
            for (var i = 0; i < msg.msg.length; i++) {

                if (i % 2 == 0)
                    arr.push("<tr bgcolor='#FFFFFF'>");
                else
                    arr.push("<tr bgcolor='#EEEDED'>");
                arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                arr.push(" <input type=\"text\"  name=\"txtTypeName\" value='" + msg.msg[i].typename + "' />");
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                arr.push("<input type=\"text\" name=\"txtUrl\" value='" + msg.msg[i].url + "' />");
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                arr.push("<input type=\"text\" name=\"txtRemark\" value='"+msg.msg[i].remark+"' ");
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                arr.push(" <input    type='button'  value='删除' onclick=\"delRow(this,'tb1')\" ");
                arr.push("</td>");
                arr.push("</tr>");
            }

            arr.push("</table>");
            document.getElementById('divadminUrl').innerHTML = arr.join('');
        }

        function delRow(row, tbname) {
            var tbl = document.getElementById(tbname);
            var rowIndex = row.parentNode.parentNode.rowIndex;
            tbl.deleteRow(rowIndex);
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <table style="text-align: center; width: 50%;">
        <tr>
            <td align="center">
                <div id="divadminUrl">
                    <img src="../../images/loading.gif" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <input id="btnadd" type="button" value="增加行" onclick="btnAddTR()" />
                &nbsp;<asp:Button
                    ID="Button1" runat="server" Text="保 存" onclick="Button1_Click" />
            </td>
        </tr>
    </table>

    <script type="text/javascript">
        function btnAddTR() {
            for (var i = 0; i < 4; i++) {
                var tbl = document.getElementById("tb1");
                var rid = "txt_row_" + tbl.rows.length;
                var row = tbl.insertRow(tbl.rows.length);
                var cell0 = row.insertCell(0);
                var cell1 = row.insertCell(1);
                var cell2 = row.insertCell(2);

                var cell3 = row.insertCell(3);
                cell0.innerHTML = " <input type=\"text\"  name=\"txtTypeName\" id=\"" + rid + "_" + "txt1" + "\"/>";
                cell1.innerHTML = "<input type=\"text\" name=\"txtUrl\"  id=\"" + rid + "_" + "txt2" + "\"/>";
                cell2.innerHTML = " <input type=\"text\" name=\"txtRemark\"  id=\"" + rid + "_" + "txt3" + "\"/>";
                cell3.innerHTML = " <input    type='button'  value='删除' onclick=\"delRow(this,'tb1')\" />";
            }
        }

        function btnin() {
            var obj = document.getElementsByName('txtTypeName');
           
            for (var i = 0; i < obj.length; i++) {
                alert(obj[i].value)
             }
        }
    </script>

    </form>
</body>
</html>
